package cn.battlecruiser.vishnu.auth.token.converter;

import java.util.Map;

import org.springframework.security.core.userdetails.User;
import org.springframework.security.oauth2.common.DefaultOAuth2AccessToken;
import org.springframework.security.oauth2.common.OAuth2AccessToken;
import org.springframework.security.oauth2.provider.OAuth2Authentication;
import org.springframework.security.oauth2.provider.token.store.JwtAccessTokenConverter;

import cn.battlecruiser.vishnu.auth.constant.SecurityConstants;
import cn.battlecruiser.vishnu.common.model.Userinfo;

public class JwtAccessToken extends JwtAccessTokenConverter {
	 @Override
	    public Map<String, ?> convertAccessToken(OAuth2AccessToken token, OAuth2Authentication authentication) {
	        Map<String, Object> representation = (Map<String, Object>) super.convertAccessToken(token, authentication);
	        representation.put("license", SecurityConstants.LICENSE);
	        return representation;
	    }

    /**
     * 解析token
     * @param value
     * @param map
     * @return
     */
    @Override
    public OAuth2AccessToken extractAccessToken(String value, Map<String, ?> map){
        return super.extractAccessToken(value, map);
    }
    
    @Override
    public OAuth2Authentication extractAuthentication(Map<String, ?> map) {
        return super.extractAuthentication(map);
    }

    
}
